Skip to content

test(examples/chat): reap e2e server process groups + pre-free ports#678

Merged
blove merged 1 commit into
mainfrom
fix/chat-e2e-teardown
Jun 17, 2026
Merged

test(examples/chat): reap e2e server process groups + pre-free ports#678
blove merged 1 commit into
mainfrom
fix/chat-e2e-teardown

Conversation

@blove

@blove blove commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Problem

examples/chat Playwright global-setup spawns nx serve (:4200) and langgraph dev (:2024). Both fork child processes that hold the actual sockets, but global-teardown only SIGTERM-ed the parents — so the real port-holders survived. A run killed mid-flight skipped teardown entirely. Either way, the next run's waitForPort bound to the stale server and silently tested the old bundle.

This bit me directly while fixing #677: a fix looked like it had no effect for ~4 e2e iterations, because the served bundle was stale.

Fix

  • global-setup: freePort(:4200/:2024) before starting (recover from a prior orphan); spawn both servers detached: true so they lead their own process groups.
  • global-teardown: kill the process groups (SIGTERM → SIGKILL backstop), then free the ports as a final backstop.
  • process-utils: freePort (best-effort lsof, no-ops if absent) + killTree helpers.

Verification

Full chat e2e suite runs clean, and both ports are FREE afterward — previously they were orphaned. (Pre-rebase the suite showed the one expected error-handling failure from the GM-2 base lacking #677; rebased onto current main it's 41/41.)

🤖 Generated with Claude Code

The Playwright global-setup spawns `nx serve` (:4200) and `langgraph dev`
(:2024); both fork child processes that hold the actual sockets. Teardown
only `SIGTERM`-ed the parents, so the real port-holders survived — and a run
killed mid-flight skipped teardown entirely. The next run's `waitForPort`
then bound to the STALE server and silently tested the OLD bundle.

- global-setup: free :4200/:2024 before starting (recover from a prior
  orphan) and spawn both servers `detached: true` so they lead their own
  process groups.
- global-teardown: kill the process GROUPS (SIGTERM then SIGKILL backstop),
  then free the ports as a final backstop.
- process-utils: freePort (best-effort lsof) + killTree helpers.

Verified: full chat e2e suite runs clean and both ports are FREE afterward
(previously orphaned).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment Jun 17, 2026 4:01am

Request Review

@blove blove enabled auto-merge (squash) June 17, 2026 04:01
@blove blove merged commit c1ae4eb into main Jun 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant